home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / c80tcog.lbr / NORMCR.CQ / normcr.c
Text File  |  1985-08-09  |  2KB  |  66 lines

  1. /* normcr - normalize a cryptogram to standard alphabet    */
  2. /*                                                      1982/10/24 17:07
  3.  
  4.         Copyright 1982  William G. Hutchison, Jr.
  5.                         P.O. Box 278
  6.                         Exton, PA 19341-0278
  7.                         U.S.A.
  8.  
  9.                         CompuServe 70665,1307
  10.  
  11.  
  12.     This  program  may be used freely for any non-commercial
  13. purpose, provided that the user does  not  remove  or  alter
  14. this notice or the copyright statement.
  15.     Those  who  wish  to  sell  or lease this program, or to
  16. incorporate it into a product  for  sale  or  lease,  should
  17. apply to the author (above) for licensing information.
  18.     This  program  is  not  covered  by  a  warranty, either
  19. express or implied. The author shall not be responsible  for
  20. any  damages (including consequential) caused by reliance on
  21. the  materials  presented,  including  but  not  limited  to
  22. typographical errors or arithmetic errors.
  23.  
  24.  
  25.  
  26.  */
  27.  
  28. #define MAINLY
  29. #include "c80def.h"
  30.  
  31. #ifdef ASCII
  32. #define NCHARS 128
  33. #else
  34. #define NCHARS 256
  35. #endif
  36.  
  37.  
  38. #ifdef CP_M
  39. extern FILE *STDIN, *STDOUT;
  40. static FILE *STDERR;
  41. #endif
  42.  
  43. main (argc, argv)
  44. int argc;
  45. char **argv;
  46. {
  47. static char Version[]= "$W$ $D$";
  48. char tr[NCHARS];
  49. static char nc[]=
  50. "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
  51. register int c, nci;
  52.  
  53.         for     (c= NCHARS-1; c >= 0; c--)
  54.                 tr[c]= EOS;
  55.     tr[NEWLINE]= NEWLINE;
  56.     tr[' ']= ' ';
  57.  
  58.     nci= 0;
  59.         while   ((c= getchar()) != EOF)
  60.         {
  61.     if    (tr[c] == EOS)
  62.         tr[c]= nc[nci]? nc[nci++] : '?';
  63.     putchar(tr[c]);
  64.     }
  65. }                               /* end main */
  66.